<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/6/25
 * Time: 20:36
 */

namespace Admin\Model;


use Common\Model\CommonModel;

class OrderModel extends CommonModel
{
    protected $tableName = 'order';
    protected $detailTableName = 'order_extend';
    protected $evalTableName = 'comment';

    public function getProductDetail($orderId){
        if(empty($orderId)) return false;
        return M($this->detailTableName)->where(array('order_id'=>$orderId))->select();
    }

    public function getOrderEval($orderId){
        if(empty($orderId)) return false;
        return M($this->evalTableName)->where(array('order_id'=>$orderId))->find();
    }

    public function reply($orderId,$content){
        if(empty($orderId) || empty($content)) return false;

        $data = array();
        $data['replay_content'] = $content;
        $data['replay_time'] = NOW_TIME;
        
        return M($this->evalTableName)->where(array('order_id'=>$orderId))->save($data);
    }
}